package day3;

/**
 * @author oldliu
 * @since 1.0
 */
//可变
public class Calc {
    public int add(int a,int b){
        return a+b;
    }
    public int add(int a,int b,int c){
        return a+b+c;
    }
    public int add(int ar[]){
        int sum=0;
        for(int i=0;i<ar.length;i++)
            sum+=ar[i];
        return sum;
    }
    public int jia(int...ar){
        int sum=0;
        for(int i=0;i<ar.length;i++)
            sum+=ar[i];
        return sum;
    }

    public static void main(String[] args) {
        Calc c=new Calc();
        int he = c.jia(1, 3, 5);
        System.out.println(he);
        he = c.jia(55);
        System.out.println(he);
        he = c.jia();
        System.out.println(he);
//        int []a={1,2,4,5,6,8,100};
//        int add = c.add(a);
//        System.out.println("和是"+add);
//        int add3 = c.add(new int[]{1, 2, 4, 5, 55});
//        System.out.println(add3);
    }
}
